using System;
using System.Data;
using System.Collections;

namespace APP.QUANLY.Entity
{
    /// <summary>
    /// Summary description for LOAINHANVIEN.
    /// </summary>
    public class LOAINHANVIENList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public LOAINHANVIENList()
    	{
	    }

		public void Add(LOAINHANVIEN entity)
		{
            this.List.Add(entity);
		}

		public void Add(LOAINHANVIENList list)
		{	
			foreach(LOAINHANVIEN entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual LOAINHANVIEN this[int index]
		{
		    get
			{
				return (LOAINHANVIEN)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual LOAINHANVIEN Find(Int32 MALOAI)
	{
	    foreach (LOAINHANVIEN obj in this.List)
	    {
		if(obj.MALOAI.ToString().ToUpper().Trim() == MALOAI.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual LOAINHANVIENList FindListByMALOAI(Int32 MALOAI)
{
	try
	{
		LOAINHANVIENList List = new LOAINHANVIENList();
		foreach (LOAINHANVIEN obj in this.List)
		{
		    if(obj.MALOAI.ToString().ToUpper().Trim() == MALOAI.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual LOAINHANVIEN FindByTENLOAI(string TENLOAI)
        {
	        foreach (LOAINHANVIEN obj in this.List)
	        {
		        if(obj.TENLOAI.ToString().ToUpper().Trim() == TENLOAI.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual LOAINHANVIEN FindByISUSE(bool ISUSE)
        {
	        foreach (LOAINHANVIEN obj in this.List)
	        {
		        if(obj.ISUSE.ToString().ToUpper().Trim() == ISUSE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual LOAINHANVIENList FindListByTENLOAI(string TENLOAI)
{
	try
	{
		LOAINHANVIENList List = new LOAINHANVIENList();
		foreach (LOAINHANVIEN obj in this.List)
		{
			if(obj.TENLOAI.ToString().ToUpper().Trim() == TENLOAI.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual LOAINHANVIENList FindListByISUSE(bool ISUSE)
{
	try
	{
		LOAINHANVIENList List = new LOAINHANVIENList();
		foreach (LOAINHANVIEN obj in this.List)
		{
			if(obj.ISUSE.ToString().ToUpper().Trim() == ISUSE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(LOAINHANVIENList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public LOAINHANVIEN Current
			{
				get
				{
					return (LOAINHANVIEN)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (LOAINHANVIEN)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}